﻿@model PagedList<ChargeInfo>
@{
    Kongt.IServices.QueryModel.ChargeQuery p = (Kongt.IServices.QueryModel.ChargeQuery)ViewBag.p;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/css/select.css" rel="stylesheet" type="text/css" />
    <link href="/css/chargeinfo.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="/js/select-ui.min.js"></script>
    <script language="javascript">
        $(function () {
            //导航切换
            $(".imglist li").click(function () {
                $(".imglist li.selected").removeClass("selected")
                $(this).addClass("selected");
            })
        })
    </script>
    <script type="text/javascript">

        var api = {
            searchCustomer: '/user/FindByCustomerId',
            updateStat: '/charge/UpdateChargeStat'
        }


        $(document).ready(function () {
            $(".click").click(function () {
                $(".tip").fadeIn(200);
            });

            $(".tiptop a").click(function () {
                $(".tip").fadeOut(200);
            });

            $(".sure").click(function () {
                $(".tip").fadeOut(100);
            });

            $(".cancel").click(function () {
                $(".tip").fadeOut(100);
            });


            //已抄表修改
            $(".clickchargemodify").click(function () {
                $(".tipchargemodify").fadeIn(200);
            });

            $(".tiptopchargemodify a").click(function () {
                $(".tipchargemodify").fadeOut(200);
            });

            $(".surechargemodify").click(function () {
                $(".tipchargemodify").fadeOut(100);
            });

            $(".cancelchargemodify").click(function () {
                $(".tipchargemodify").fadeOut(100);
            });

            //已收费查询
            $(".clickchargesearch").click(function () {
                $(".tipchargesearch").fadeIn(200);
            });

            $(".tiptopchargesearch a").click(function () {
                $(".tipchargesearch").fadeOut(200);
            });

            $(".surechargesearch").click(function () {
                $(".tipchargesearch").fadeOut(100);
            });

            $(".cancelchargesearch").click(function () {
                $(".tipchargesearch").fadeOut(100);
            });

            //删除用户
            $(".clickdel").click(function (del) {

                var count = $("input:checked").length;
                if (count < 1) {
                    alert("至少选择一项进行修改！");
                }  
                else {
                    $(".tipdel").fadeIn(200); 
                } 
            });

            $(".tiptopdel a").click(function (del) {
                $(".tipdel").fadeOut(200);
            });


            $(".suredel").click(function (del) { 
                var ids = [];
                $('input:checked').each(function () {
                    ids.push($(this).val());
                });
                $.post(api.updateStat, { stat:2,ids:ids.join(',')}, function (data) {
                    $(".tipdel").fadeOut(100); 
                }, 'json') 
            });


            $(".canceldel").click(function (del) {
                $(".tipdel").fadeOut(100);
            });

            $('#ul1').find("select[name='CollectDateStart']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='CollectDateStart']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='CollectDateStart']").prev().find("em:first").text($('#ul1').find("select[name='CollectDateStart']").find("option:selected").text());

            $('#ul1').find("select[name='CollectDateEnd']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='CollectDateEnd']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='CollectDateEnd']").prev().find("em:first").text($('#ul1').find("select[name='CollectDateEnd']").find("option:selected").text());


            $('#ul1').find("select[name='WaterTypeId']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='WaterTypeId']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='WaterTypeId']").prev().find("em:first").text($('#ul1').find("select[name='WaterTypeId']").find("option:selected").text());



            $('#ul1').find("select[name='ReadPersonId']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='ReadPersonId']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='ReadPersonId']").prev().find("em:first").text($('#ul1').find("select[name='ReadPersonId']").find("option:selected").text());


            $('#ul1').find("select[name='FirstArea']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='FirstArea']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='FirstArea']").prev().find("em:first").text($('#ul1').find("select[name='FirstArea']").find("option:selected").text());



            $('#ul1').find("select[name='SecondArea']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='SecondArea']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='SecondArea']").prev().find("em:first").text($('#ul1').find("select[name='SecondArea']").find("option:selected").text());



            $('#ul1').find("select[name='Collector']").find("option:first").before("<option value=''>请选择</option>");
            $('#ul1').find("select[name='Collector']").find("option:first").attr("selected", true);
            $('#ul1').find("select[name='Collector']").prev().find("em:first").text($('#ul1').find("select[name='Collector']").find("option:selected").text());


        });

        ///搜索
        function Search() {
            var customerId = $('#ul1').find("[name='UserCustomerId']").val();
            $.post(api.searchCustomer, { customerId: customerId }, function (data) {
                if (data.Succeed) {
                    $('#ul1').find('[name="CustomId"]').val(data.Obj.Id);
                    $('#ul1').find('[name="Name"]').val(data.Obj.Name);
                    $('#ul1').find('[name="MeterNo"]').val(data.Obj.MeterNo);

                    $('#ul1').find("select[name='ReadPersonId']").find("option[value='" + data.Obj.ReadPersonId + "']").attr("selected", true);
                    $('#ul1').find("select[name='ReadPersonId']").prev().find("em:first").text($('#ul1').find("select[name='ReadPersonId']").find("option:selected").text());

                    $('#ul1').find("select[name='WaterTypeId']").find("option[value='" + data.Obj.WaterTypeId + "']").attr("selected", true);
                    $('#ul1').find("select[name='WaterTypeId']").prev().find("em:first").text($('#ul1').find("select[name='WaterTypeId']").find("option:selected").text());

                    $('#ul1').find("select[name='FirstArea']").attr('secondArea', data.Obj.SecondArea);
                    $('#ul1').find("select[name='FirstArea']").find("option[value='" + data.Obj.FirstArea + "']").attr("selected", true);
                    $('#ul1').find("select[name='FirstArea']").prev().find("em:first").text($('#form2').find("select[name='FirstArea']").find("option:selected").text());
                    $('#ul1').find("select[name='FirstArea']").trigger("change");





                } else {
                    alert(data.Msg);
                }

            }, 'json')
        }



    </script>
    <script type="text/javascript">
        $(document).ready(function (e) {
            $(".select1").uedSelect({
                width: 345
            });
            $(".select2").uedSelect({
                width: 167
            });
            $(".select3").uedSelect({
                width: 150
            });
        });
    </script>
</head>
<body>
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">收费管理</a></li>
            <li><a href="#">已收费查询</a></li>
        </ul>
    </div>
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li class="clickchargesearch"><span><img src="/images/t10.png" /></span>查询</li>
                <li class="clickdel"><span><img src="/images/t03.png" /></span>作废</li>
                <li class="clickfrommodify"><span><img src="/images/t09.png" /></span>导出</li>
                <li class="clickdel"><span><img src="/images/t08.png" /></span>打印</li>

            </ul>

        </div>
        <table class="imgtable">
            <thead>
                <tr>
                    <th>选择</th>
                    <th>用户编号</th>
                    <th>用户姓名</th>
                    <th>区域分布</th>
                    <th>区域名称</th>
                    <th>详细地址</th>
                    <th>用水类别</th>
                    <th>上期底数</th>
                    <th>本期底数</th>
                    <th>用水量</th>
                    <th>单价</th>
                    <th>水费金额</th>
                    <th>滞纳金</th>
                    <th>应收金额</th>
                    <th>收费状态</th>
                    @*<th>预付余额</th>
                        <th>收款金额</th>
                        <th>本次找零</th>*@

                    <th>收费人员</th>
                    <th>收费日期</th>
                    <th>抄表人员</th>
                    <th>抄表日期</th>
                </tr>
            </thead>
            <tbody>
                @if (Model.TotalItemCount > 0)
                {
                    foreach (var item in Model)
                    {
                        <tr>
                            <td><input name="" type="checkbox" value="@(item.Id)" /></td>
                            <td>@(item.Customer?.CustomerId)</td>
                            <td height="30px;">@(item.Customer?.CustomerName)</td>
                            <td><a href="#">@(item.Customer?.FirstArea)</a></td>
                            <td>@(item.Customer?.SecondArea)</td>
                            <td>@(item.Customer?.DetailAddress)</td>
                            <td>@(item.Customer?.WaterType.TypeName)</td>
                            <td>@(item?.LastMeterShow)</td>
                            <td>@(item?.ThisMeterShow)</td>
                            <td>@(item?.WaterMuch)</td>
                            <td>@(item?.WaterPrice)</td>
                            <td>@(item?.TotalWaterPrice)</td>
                            <td>@(item?.LateFee)</td>
                            <td>@(item?.TotalPrice)</td>
                            <td>@(((ChargeInfo.StateEnum)item.State).ToDescription())</td>
                            @*<td>10</td>
                                <td>111</td>
                                <td>222</td>*@
                            <td>@(item.ManagerInfo?.UserName)</td>
                            <td>@(item?.ColectMoneyDate?.ToString("yyyy/MM/dd"))</td>
                            <td>@(item.Customer?.EmployeeInfo.NAME)</td>
                            <td>@(item.ThisTime)</td>
                        </tr>
                    }


                }

            </tbody>
        </table>
        <div class="pagin">
            <div class="message">共<i class="blue">@(Model.TotalItemCount)</i>条记录，共&nbsp;<i class="blue">@(Model.TotalPageCount)&nbsp;</i>页</div>
            @Html.Pager(Model, BaseController.PagerOptions)
        </div>


        <!--作废收费-->
        <div class="tipdel">
            <div class="tiptopdel"><span>提示信息</span><a></a></div>
            <div class="tipinfodel">
                <span><img src="/images/ticon01.png" /></span>
                <div class="tiprightdel">
                    <p>确定要作废选中的记录吗？</p>
                    <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
                </div>
            </div>
            <div class="tipbtndel">
                <input name="" type="button" class="suredel" value="确定" />
                &nbsp;
                <input name="" type="button" class="canceldel" value="取消" />
            </div>
        </div>



        <!--修改收费-->
        <div class="tipchargemodify">
            <div class="tiptopchargemodify"><img src="/images/t06.png" /><span>修改收费数据</span><a></a></div>
            <div class="tipinfochargemodify">
                <div class="userinfozbchargemodify">
                    <dt class="userinfozbtitchargemodify">抄表信息</dt>
                    <ul class="seachform">
                        <li>
                            <label>用户编号</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>应收金额</label>
                            <input name="" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>本期底数</label>
                            <input name="" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>本期水损</label>
                            <input name="" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>抄表日期</label>
                            <div class="vocation">
                                <select class="select3" disabled="false">
                                    <option>2017年2月12日</option>
                                </select>
                            </div>
                        </li>
                        <li>
                            <label>水表状态</label>
                            <div class="vocation">
                                <select class="select3">
                                    <option>正常</option>
                                </select>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="tiprightchargemodify">
                    <dt class="userinfotitchargemodify">用户信息</dt>
                    <ul class="seachform">
                        <li>
                            <label>用户姓名</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>用水类型</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>水表编号</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>

                        <li>
                            <label>区域分布</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>区域名称</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>详细地址</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>

                        <li>
                            <label>抄表人员</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>用户性质</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>
                        <li>
                            <label>建档日期</label>
                            <input name="" type="text" class="scinput" disabled="disabled" style="background:#EFEFEF" />
                        </li>

                    </ul>
                </div>
            </div>
            <div class="tipbtnchargemodify">
                <input name="" type="button" class="surechargemodify" value="确定" />
                &nbsp;
                <input name="" type="button" class="cancelchargemodify" value="取消" />
            </div>
        </div>

        <form>


            <!--已收费查询-->
            <div class="tipchargesearch">
                <div class="tiptopchargesearch"><img src="/images/t06.png" /><span>已收费查询</span><a></a></div>
                <div class="tipinfochargesearch">
                    <div class="tiprightchargesearch">
                        <dt class="userinfotitchargesearch">请输入查询条件</dt>
                        <ul class="seachform" id="ul1">
                            <li>
                                <label>用户编号</label>
                                <input type="text" class="scinput" name="UserCustomerId" value="" onkeyup="Search()" />
                                @Html.Hidden("CustomId", "")
                                @Html.Hidden("Stat",((int)p.Stat.Value).ToString())
                                @Html.Hidden("colectType", "")
                            </li>
                            <li>
                                <label>用户姓名</label>
                                <input name="Name" type="text" class="scinput" />
                            </li>
                            <li>
                                <label>水表编号</label>
                                <input name="MeterNo" type="text" class="scinput" />
                            </li>

                            @Html.Action("_LinkArea", "Common")

                            @Html.Action("_WaterType", "Common", new { id = "addsellssss" })

                            <li class="aclear">
                                <label>收费日期</label>
                                <div class="vocation">
                                    <select class="select3" name="CollectDateStart">
                                        @{
                                            var date = DateTime.Now.AddMonths(-6);
                                            var startDate = new DateTime(date.Year, date.Month, 1);
                                            while (startDate < DateTime.Now.AddMonths(1))
                                            {
                                                <option value="@(startDate.ToString("yyyy/MM/dd"))">@(startDate.Year)年@(startDate.Month)月@(startDate.Day)日</option>
                                                startDate = startDate.AddDays(15);
                                            }
                                        }
                                    </select>
                                </div>
                            </li>

                            <li>
                                <label>为止日期</label>
                                <div class="vocation">
                                    <select class="select3" name="CollectDateEnd">
                                        @{
                                            var date1 = DateTime.Now.AddMonths(-6);
                                            var startDate1 = new DateTime(date1.Year, date1.Month, 1);
                                            while (startDate1 < DateTime.Now.AddMonths(1))
                                            {
                                                <option value="@(startDate1.ToString("yyyy/MM/dd"))">@(startDate1.Year)年@(startDate1.Month)月@(startDate1.Day)日</option>
                                                startDate1 = startDate1.AddDays(15);
                                            }
                                        }
                                    </select>
                                </div>
                            </li>

                            <li>
                                <label>抄表人员</label>
                                <div class="vocation">
                                    @Html.Action("_Employees", "Common", new { cssClass = "select3" })
                                </div>
                            </li>
                            <li>
                                <label>收费人员</label>
                                <div class="vocation">
                                    @Html.Action("_Managers", "Common", new { name = "Collector", id = "Collector", cssClass = "select3" })
                                </div>
                            </li>


                        </ul>
                    </div>
                </div>
                <div class="tipbtnchargesearch">
                    <input name="sure" type="submit" class="surechargesearch" value="查询" />
                    &nbsp;
                    <input name="" type="button" class="cancelchargesearch" value="取消" />
                </div>
            </div>
        </form>

        <script type="text/javascript">
            $('.tablelist tbody tr:odd').addClass('odd');
        </script>
    </div>
</body>
</html>
